<?php

namespace App\Models;

use DateTimeInterface;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
 * Class MeetOrder
 * *
 * @property $id  自增ID
 * @property $meet_hour_id  场馆小时id
 * @property $meet_person_id  预约人id
 * @property $audit_status  审核状态 0:待审核 1:已审核 2:拒绝 3:取消
 * @property $created_at
 * @property $updated_at
 * @property $deleted_at
 *
 * @package  App\Models
 * @mixin \Illuminate\Database\Eloquent\Builder
 */
class MeetOrder extends Model
{
    use SoftDeletes;

    protected $table = 'meet_orders';

    protected $fillable = ['meet_hour_id', 'meet_person_id', 'venue_id', 'add_uid', 'audit_status'];

    protected function serializeDate(DateTimeInterface $date)
    {
        return $date->format($this->dateFormat ?: 'Y-m-d H:i:s');
    }

    public function hour()
    {
        return $this->belongsTo(MeetHour::class, 'meet_hour_id', 'meet_hour_id');
    }
    public function person()
    {
        return $this->belongsTo(MeetPerson::class, 'meet_person_id');
    }
}
